package com.EVO.controller;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;

public class Servlet2 extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        HttpSession session = request.getSession();
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out = response.getWriter();
        Enumeration names = session.getAttributeNames();
        while(names.hasMoreElements()){
            String name = (String) names.nextElement();
            int nameNum = (int) session.getAttribute(name);
            out.print("商品名称: "+name+"  商品数量: "+nameNum+"<br>");
        }

    }
}
